public void close() throws IOException {
if (channel != null && channel.isConnected()) {
send(new TinyRequest(Tiny.CLOSE));
if (outChannel != null) {
disableOutGauge();
disableOutSim();
outChannel.close();
}
channel.close();
}
}
public void close() throws IOException {
if (channel != null && channel.isConnected()) {
if (outChannel != null) {
disableOutGauge();
disableOutSim();
outChannel.close();
}
send(new TinyRequest(Tiny.CLOSE));
channel.close();
}
}
...
Channel channel = new TCPChannel("127.0.0.1", 29999);
SimpleClient client = new SimpleClient();
client.addListener(this);
client.connect(channel,
"somepassword",
"someInsimName",
(short) (InitRequest.[I]RECEIVE_NODE_LAP | [/I][COLOR=Red]InitRequest.[I]LOCAL[/I][/COLOR]),
0, 0, '!');
...
struct IS_NCN // New ConN
{
byte Size; // 56
byte Type; // ISP_NCN
byte ReqI; // 0 unless this is a reply to a TINY_NCN request
byte UCID; // new connection's unique id (0 = host)
char UName[24]; // username
char PName[24]; // nickname
byte Admin; // 1 if admin
byte Total; // number of connections including host
[COLOR=Red]byte Flags; // bit 2 : remote[/COLOR]
byte Sp3;
};
struct IS_CNL // ConN Leave
{
byte Size; // 8
byte Type; // ISP_CNL
byte ReqI; // 0
byte UCID; // unique id of the connection which left
[COLOR=Red]byte Reason; // leave reason (see below)[/COLOR]
byte Total; // number of connections including host
byte Sp2;
byte Sp3;
};
Dim testTOC As Integer = 0
Private Sub TOC_PlayerCarTakeOver(ByVal TOC As Packets.IS_TOC)
Players(GetPlyIdx(TOC.OldUCID)).UniqueID = TOC.NewUCID ' Update Players[] list
Players(GetPlyIdx(TOC.OldUCID)).PlayerID = TOC.PLID ' Update Players[] list
testTOC += 1
InSim.Send_MST_Message("TOC#: " & testTOC.ToString & " NewUCID: " & TOC.NewUCID.ToString & " OldUCID: " & TOC.OldUCID.ToString & " PLID: " & TOC.PLID.ToString)
End Sub
Host: TOC#: 1 NewUCID: 5 OldUCID: 0 PLID: 1
Host: TOC#: 2 NewUCID: 5 OldUCID: 0 PLID: 1
Host: TOC#: 3 NewUCID: 5 OldUCID: 0 PLID: 1